<!DOCTYPE html>
<html lang="en">
<head>
	<meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8" />
    <meta http-equiv="Cache-Control" content="no-siteapp" />
	<meta charset="UTF-8">
	<title>投票结果</title>
	<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1">
	<script src="/vote/static/js/jquery-3.3.1.min.js"></script>
	<script src="/vote/static/js/echarts.min.js"></script>
	<link rel="icon" href="/vote/admin/t_logo.ico" type="img/x-ico" />
</head>
<body>
	<!-- 为ECharts准备一个具备大小（宽高）的Dom -->
	<div id="content" style="width: 100%;height:560px;">>
		<div id="result" style="width: 100%;height:90%;"></div>
	</div>
	
    <script type="text/javascript">
    
    setInterval(function () {	     
    		$.get("/vote/uservote/result", function(item){
    			var ticket=[];
                var players=[];
    			for(i in item){
    	        	ticket[i]=item[i].ticket;
    	        	players[i]=item[i].playername;
    	        			}
    			var myChart = echarts.init(document.getElementById('result'));

    	        // 指定图表的配置项和数据
    	        var option = {
    	            title: {
    	                text: '观众投票结果',
    	                top: '3%',
    	        	    left: '10%'
    	            },
    	            tooltip: {},
    	            xAxis: {
    		          data: players 
    	            },
    	            yAxis: {
    	            	show: false,
    	            	min : 0,
    	            	max : 30
    	            },
    	            series: [{
    	                name: '得票',
    	                type: 'bar',
    	                data: ticket,
    	                barWidth : 40,
    	                itemStyle: {
    	                    normal: {
    	                        label: {
    	                            show: true,		//开启显示
    	                            position: 'top',	//在上方显示
    	                            textStyle: {	    //数值样式
    	                            	color: 'black',
    	                                fontSize: 16
    	                            }
    	                        }
    	                    }
    	                }
    	            }]
    	        };
    	        // 使用刚指定的配置项和数据显示图表。
    	        myChart.setOption(option);
    				});	
    	
    	//playervote数据
    	//var item = ${playervote};
        // 基于准备好的dom，初始化echarts实例
    }, 3000);
     	
    </script>
</body>
</html>
